package com.baidu.day03;

import java.io.File;

public class Demo08 {
    public static void main(String[] args) {
        File f = new File("C:\\Users\\DAJU\\Desktop\\新建文件夹 (2)");
        File[] files = f.listFiles();

//        File f2 = new File("C:\\Users\\DAJU\\Desktop\\新建文件夹 (2)\\docx");
//        File f3 = new File("C:\\Users\\DAJU\\Desktop\\新建文件夹 (2)\\zip");
//        File f4 = new File("C:\\Users\\DAJU\\Desktop\\新建文件夹 (2)\\txt");
        for (File file : files) {
            String s = file.getName();
            String[] str = s.split("\\.");
            File f2 = new File(file.getParent()+"\\"+str[1]);
            f2.mkdir();
            File f3 = new File(file.getParent()+"\\"+str[1]+"\\"+s);
            file.renameTo(f3);


        }

    }

}
